/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2022 Huawei Technologies Co., Ltd */

#ifndef HIUDK3_HW_H
#define HIUDK3_HW_H

#include <linux/types.h>
#include "mpu_inband_cmd_defs.h"
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 0x4321
#endif

#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 0x1234
#endif

#ifdef BYTE_ORDER
#undef BYTE_ORDER
#endif
/* X86 */
#define BYTE_ORDER LITTLE_ENDIAN
/* to use 0-level CLA, page size must be: SQ 16B(wqe) * 64k(max_q_depth) */
#define HINIC3_DEFAULT_WQ_PAGE_SIZE 0x100000
#define HINIC3_HW_WQ_PAGE_SIZE 0x1000
#define HINIC3_MAX_WQ_PAGE_SIZE_ORDER 8
#define SPU_HOST_ID 4

enum hinic3_channel_id {
    HINIC3_CHANNEL_DEFAULT,
    HINIC3_CHANNEL_COMM,
    HINIC3_CHANNEL_NIC,
    HINIC3_CHANNEL_ROCE,
    HINIC3_CHANNEL_TOE,
    HINIC3_CHANNEL_FC,
    HINIC3_CHANNEL_OVS,
    HINIC3_CHANNEL_DSW,
    HINIC3_CHANNEL_MIG,
    HINIC3_CHANNEL_CRYPT,
    HINIC3_CHANNEL_VROCE,

    HINIC3_CHANNEL_MAX = 32,
};

struct hinic3_cmd_buf {
    void *buf;
    dma_addr_t dma_addr;
    u16 size;
    /* Usage count, USERS DO NOT USE */
    atomic_t ref_cnt;
};

enum hinic3_aeq_type {
    HINIC3_HW_INTER_INT = 0,
    HINIC3_MBX_FROM_FUNC = 1,
    HINIC3_MSG_FROM_MGMT_CPU = 2,
    HINIC3_API_RSP = 3,
    HINIC3_API_CHAIN_STS = 4,
    HINIC3_MBX_SEND_RSLT = 5,
    HINIC3_MAX_AEQ_EVENTS
};

enum hinic3_aeq_sw_type { HINIC3_STATELESS_EVENT = 0, HINIC3_STATEFUL_EVENT = 1, HINIC3_MAX_AEQ_SW_EVENTS };

enum hinic3_hwdev_init_state {
    HINIC3_HWDEV_NONE_INITED = 0,
    HINIC3_HWDEV_MGMT_INITED,
    HINIC3_HWDEV_MBOX_INITED,
    HINIC3_HWDEV_CMDQ_INITED,
};

struct hinic3_ceq_info {
	u32 q_len;
	u32 page_size;
	u16 elem_size;
	u16 num_pages;
	u32 num_elem_in_pg;
};

enum hinic3_ceq_event {
    HINIC3_NON_L2NIC_SCQ,
    HINIC3_NON_L2NIC_ECQ,
    HINIC3_NON_L2NIC_NO_CQ_EQ,
    HINIC3_CMDQ,
    HINIC3_L2NIC_SQ,
    HINIC3_L2NIC_RQ,
    HINIC3_MAX_CEQ_EVENTS,
};

enum hinic3_mbox_seg_errcode {
	MBOX_ERRCODE_NO_ERRORS		= 0,
	/* VF send the mailbox data to the wrong destination functions */
	MBOX_ERRCODE_VF_TO_WRONG_FUNC	= 0x100,
	/* PPF send the mailbox data to the wrong destination functions */
	MBOX_ERRCODE_PPF_TO_WRONG_FUNC	= 0x200,
	/* PF send the mailbox data to the wrong destination functions */
	MBOX_ERRCODE_PF_TO_WRONG_FUNC	= 0x300,
	/* The mailbox data size is set to all zero */
	MBOX_ERRCODE_ZERO_DATA_SIZE	= 0x400,
	/* The sender function attribute has not been learned by hardware */
	MBOX_ERRCODE_UNKNOWN_SRC_FUNC	= 0x500,
	/* The receiver function attr has not been learned by hardware */
	MBOX_ERRCODE_UNKNOWN_DES_FUNC	= 0x600,
};

typedef void (*hinic3_ceq_event_cb)(void *pri_handle, u32 ceqe_data);
typedef void (*hinic3_aeq_hwe_cb)(void *pri_handle, u8 *data, u8 size);
typedef u8 (*hinic3_aeq_swe_cb)(void *pri_handle, u8 event, u8 *data);
typedef int (*hinic3_vf_mbox_cb)(void *pri_handle, u16 cmd,
	     void *buf_in, u16 in_size, void *buf_out, u16 *out_size);

typedef int (*hinic3_pf_mbox_cb)(void *pri_handle, u16 vf_id, u16 cmd, void *buf_in,
	     u16 in_size, void *buf_out, u16 *out_size);

typedef int (*hinic3_ppf_mbox_cb)(void *pri_handle, u16 pf_idx, u16 vf_id, u16 cmd, void *buf_in,
	     u16 in_size, void *buf_out, u16 *out_size);

typedef int (*hinic3_pf_recv_from_ppf_mbox_cb)(void *pri_handle, u16 cmd, void *buf_in,
	     u16 in_size, void *buf_out, u16 *out_size);

typedef void (*hinic3_mgmt_msg_cb)(void *pri_handle, u16 cmd, void *buf_in, u16 in_size,
	      void *buf_out, u16 *out_size);


/**
 * @brief hiudk_aeq_register_hw_cb -  register aeq hardware callback
 * @param udkdev: device pointer to udkdev
 * @param pri_handle: pointer to private dev
 * @param event: event type
 * @param hwe_cb: callback function
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_aeq_register_hw_cb(void *udkdev, void *pri_handle, enum hinic3_aeq_type event, hinic3_aeq_hwe_cb hwe_cb);

/**
 * @brief hiudk_aeq_unregister_hw_cb - unregister aeq hardware callback
 * @param udkdev: device pointer to udkdev
 * @param event: event type
 **/
void hiudk_aeq_unregister_hw_cb(void *udkdev, enum hinic3_aeq_type event);

/**
 * @brief hiudk_aeq_register_swe_cb -  register aeq soft event callback
 * @param udkdev: device pointer to udkdev
 * @param pri_handle: pointer to private dev
 * @param event: event type
 * @param aeq_swe_cb: callback function
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_aeq_register_swe_cb(void *udkdev, void *pri_handle,
    enum hinic3_aeq_sw_type event, hinic3_aeq_swe_cb aeq_swe_cb);

/**
 * @brief hiudk_aeq_unregister_swe_cb - unregister aeq soft event callback
 * @param udkdev: device pointer to udkdev
 * @param event: event type
 **/
void hiudk_aeq_unregister_swe_cb(void *udkdev, enum hinic3_aeq_sw_type event);

/**
 * @brief hiudk_ceq_register_cb -  register ceq callback
 * @param udkdev: device pointer to udkdev
 * @param pri_handle: device pointer to private handle
 * @param event: event type
 * @param callback: callback function
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_ceq_register_cb(void *udkdev, void *pri_handle, enum hinic3_ceq_event event, hinic3_ceq_event_cb callback);

/**
 * @brief hiudk_ceq_unregister_cb - unregister ceq callback
 * @param udkdev: device pointer to udkdev
 * @param event: event type
 **/
void hiudk_ceq_unregister_cb(void *udkdev, enum hinic3_ceq_event event);

/**
 * @brief hiudk_register_ppf_mbox_cb - ppf register mbox msg callback
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param pri_handle: private data will be used by the callback
 * @param callback: callback function
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_register_ppf_mbox_cb(void *udkdev, u8 mod, void *pri_handle, hinic3_ppf_mbox_cb callback);

/**
 * @brief hiudk_register_pf_mbox_cb - pf register mbox msg callback
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param pri_handle: private data will be used by the callback
 * @param callback: callback function
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_register_pf_mbox_cb(void *udkdev, u8 mod, void *pri_handle, hinic3_pf_mbox_cb callback);
/**
 * @brief hiudk_register_vf_mbox_cb - vf register mbox msg callback
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param pri_handle: private data will be used by the callback
 * @param callback: callback function
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_register_vf_mbox_cb(void *udkdev, u8 mod, void *pri_handle, hinic3_vf_mbox_cb callback);
/**
 * @brief hiudk_unregister_ppf_mbox_cb - ppf unregister mbox msg callback
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 **/
void hiudk_unregister_ppf_mbox_cb(void *udkdev, u8 mod);

/**
 * @brief hiudk_unregister_pf_mbox_cb - pf register mbox msg callback
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 **/
void hiudk_unregister_pf_mbox_cb(void *udkdev, u8 mod);

/**
 * @brief hiudk_unregister_vf_mbox_cb - pf register mbox msg callback
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 **/
void hiudk_unregister_vf_mbox_cb(void *udkdev, u8 mod);

/**
 * @brief hiudk_register_service_adapter - register mgmt msg callback
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param pri_handle: private data will be used by the callback
 * @param callback: callback function
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_register_mgmt_msg_cb(void *udkdev, u8 mod, void *pri_handle, hinic3_mgmt_msg_cb callback);

/**
 * @brief hiudk_unregister_mgmt_msg_cb - unregister mgmt msg callback
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 **/
void hiudk_unregister_mgmt_msg_cb(void *udkdev, u8 mod);

/**
 * @brief hiudk_register_service_adapter - register service adapter
 * @param udkdev: device pointer to udkdev
 * @param service_adapter: service adapter
 * @param type: service type
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_register_service_adapter(void *udkdev, void *service_adapter, enum hinic3_service_type type);

/**
 * @brief hiudk_unregister_service_adapter - unregister service adapter
 * @param udkdev: device pointer to udkdev
 * @param type: service type
 **/
void hiudk_unregister_service_adapter(void *udkdev, enum hinic3_service_type type);

/**
 * @brief hiudk_get_service_adapter - get service adapter
 * @param udkdev: device pointer to udkdev
 * @param type: service type
 * @retval non-zero: success
 * @retval null: failure
 **/
void *hiudk_get_service_adapter(void *udkdev, enum hinic3_service_type type);

/**
 * @brief hiudk_free_db_phy_addr - free doorbell & direct wqe physical address
 * @param udkdev: device pointer to udkdev
 * @param db_base: pointer to free doorbell base address
 * @param dwqe_base: pointer to free direct base address
 **/
void hiudk_free_db_phy_addr(void *udkdev, u64 db_base, u64 dwqe_base);

/**
 * @brief hiudk_alloc_db_addr - alloc doorbell & direct wqe
 * @param udkdev: device pointer to udkdev
 * @param db_base: pointer to alloc doorbell base address
 * @param dwqe_base: pointer to alloc direct base address
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_alloc_db_addr(void *udkdev, void __iomem **db_base, void __iomem **dwqe_base);

/**
 * @brief hiudk_free_db_addr - free doorbell & direct wqe
 * @param udkdev: device pointer to udkdev
 * @param db_base: pointer to free doorbell base address
 * @param dwqe_base: pointer to free direct base address
 **/
void hiudk_free_db_addr(void *udkdev, const void __iomem *db_base, void __iomem *dwqe_base);

/**
 * @brief hiudk_alloc_db_phy_addr - alloc physical doorbell & direct wqe
 * @param udkdev: device pointer to udkdev
 * @param db_base: pointer to alloc doorbell base address
 * @param dwqe_base: pointer to alloc direct base address
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_alloc_db_phy_addr(void *udkdev, u64 *db_base, u64 *dwqe_base);

/**
 * @brief hiudk_set_root_ctxt - set root context
 * @param udkdev: device pointer to udkdev
 * @param rq_depth: rq depth
 * @param sq_depth: sq depth
 * @param rx_buf_sz: rx buffer size
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_set_root_ctxt(void *udkdev, u32 rq_depth, u32 sq_depth, int rx_buf_sz, u16 channel);

/**
 * @brief hiudk_clean_root_ctxt - clean root context
 * @param udkdev: device pointer to udkdev
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_clean_root_ctxt(void *udkdev, u16 channel);

/**
 * @brief hiudk_alloc_cmd_buf - alloc cmd buffer
 * @param udkdev: device pointer to udkdev
 * @retval non-zero: success
 * @retval null: failure
 **/
struct hinic3_cmd_buf *hiudk_alloc_cmd_buf(void *udkdev);

/**
 * @brief hiudk_free_cmd_buf - free cmd buffer
 * @param udkdev: device pointer to udkdev
 * @param cmd_buf: cmd buffer to free
 **/
void hiudk_free_cmd_buf(void *udkdev, struct hinic3_cmd_buf *cmd_buf);

/**
 * @brief hiudk_sm_ctr_rd64 - big counter 64 read
 * @param udkdev: device pointer to udkdev
 * @param node: the node id
 * @param instance: instance id
 * @param ctr_id: counter id
 * @param value: read counter value ptr
 * @retval zero: success
 * @retval non-zero: failure
 **/
int hiudk_sm_ctr_rd64(void *udkdev, u8 node, u8 instance, u32 ctr_id, u64 *value);

/**
 * @brief hiudk_api_csr_rd64 - read 64 byte csr
 * @param udkdev: device pointer to udkdev
 * @param dest: hardware node id
 * @param addr: reg address
 * @param val: reg value
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_api_csr_rd64(void *udkdev, u8 dest, u32 addr, u64 *val);

/**
 * @brief hiudk_msg_to_mgmt_sync - msg to management cpu
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param cmd: cmd
 * @param buf_in: message buffer in
 * @param in_size: in buffer size
 * @param buf_out: message buffer out
 * @param out_size: out buffer size
 * @param timeout: timeout
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_msg_to_mgmt_sync(
    void *udkdev, u8 mod, u16 cmd, void *buf_in, u16 in_size, void *buf_out, u16 *out_size, u32 timeout, u16 channel);

/**
 * @brief hiudk_msg_to_mgmt_async - msg to management cpu async
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param cmd: cmd
 * @param buf_in: message buffer in
 * @param in_size: in buffer size
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 *
 * The function does not sleep inside, allowing use in irq context
 */
int hiudk_msg_to_mgmt_async(void *udkdev, u8 mod, u16 cmd, void *buf_in, u16 in_size, u16 channel);

/**
 * @brief hiudk_msg_to_mgmt_no_ack - msg to management cpu don't need no ack
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param cmd: cmd
 * @param buf_in: message buffer in
 * @param in_size: in buffer size
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 *
 * The function will sleep inside, and it is not allowed to be used in
 * interrupt context
 */
int hiudk_msg_to_mgmt_no_ack(void *udkdev, u8 mod, u16 cmd, void *buf_in, u16 in_size, u16 channel);

int hiudk_msg_to_mgmt_api_chain_async(void *udkdev, u8 mod, u16 cmd, const void *buf_in, u16 in_size);

/**
 * @brief hiudk_mbox_to_pf - vf mbox message to pf
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param cmd: cmd
 * @param buf_in: message buffer in
 * @param in_size: in buffer size
 * @param buf_out: message buffer out
 * @param out_size: out buffer size
 * @param timeout: timeout
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_mbox_to_pf(
    void *udkdev, u8 mod, u16 cmd, void *buf_in, u16 in_size, void *buf_out, u16 *out_size, u32 timeout, u16 channel);

/**
 * @brief hiudk_mbox_to_vf - mbox message to vf
 * @param udkdev: device pointer to udkdev
 * @param vf_id: vf index
 * @param mod: mod type
 * @param cmd: cmd
 * @param buf_in: message buffer in
 * @param in_size: in buffer size
 * @param buf_out: message buffer out
 * @param out_size: out buffer size
 * @param timeout: timeout
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_mbox_to_vf(void *udkdev, u16 vf_id, u8 mod, u16 cmd, void *buf_in, u16 in_size, void *buf_out, u16 *out_size,
    u32 timeout, u16 channel);

/**
 * @brief hiudk_mbox_to_vf_no_ack - mbox message to vf no ack
 * @param udkdev: device pointer to udkdev
 * @param vf_id: vf index
 * @param mod: mod type
 * @param cmd: cmd
 * @param buf_in: message buffer in
 * @param in_size: in buffer size
 * @param buf_out: message buffer out
 * @param out_size: out buffer size
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_mbox_to_vf_no_ack(void *udkdev, u16 vf_id, u8 mod, u16 cmd, void *buf_in, u16 in_size, void *buf_out,
    u16 *out_size, u16 channel);

/**
 * @brief hiudk_cmdq_detail_resp - cmdq direct message response
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param cmd: cmd
 * @param buf_in: message buffer in
 * @param out_param: message out
 * @param timeout: timeout
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_cmdq_direct_resp(
    void *udkdev, u8 mod, u8 cmd, struct hinic3_cmd_buf *buf_in, u64 *out_param, u32 timeout, u16 channel);

/**
 * @brief hiudk_cmdq_detail_resp - cmdq detail message response
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param cmd: cmd
 * @param buf_in: message buffer in
 * @param buf_out: message buffer out
 * @param out_param: inline output data
 * @param timeout: timeout
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_cmdq_detail_resp(void *udkdev, u8 mod, u8 cmd, struct hinic3_cmd_buf *buf_in, struct hinic3_cmd_buf *buf_out,
    u64 *out_param, u32 timeout, u16 channel);

/**
 * @brief hiudk_cmdq_detail_resp - cmdq detail message response
 * @param udkdev: device pointer to udkdev
 * @param mod: mod type
 * @param cmd: cmd
 * @param cos_id: cos id
 * @param buf_in: message buffer in
 * @param buf_out: message buffer out
 * @param out_param: inline output data
 * @param timeout: timeout
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_cos_id_detail_resp(void *udkdev, u8 mod, u8 cmd, u8 cos_id, struct hinic3_cmd_buf *buf_in,
    struct hinic3_cmd_buf *buf_out, u64 *out_param, u32 timeout, u16 channel);

/**
 * @brief hiudk_ppf_tmr_start - start ppf timer
 * @param udkdev: device pointer to udkdev
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_ppf_tmr_start(void *udkdev);

/**
 * @brief hiudk_ppf_tmr_stop - stop ppf timer
 * @param udkdev: device pointer to udkdev
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_ppf_tmr_stop(void *udkdev);

/**
 * @brief hiudk_get_board_info - get board info
 * @param udkdev: device pointer to udkdev
 * @param info: board info
 * @param channel: channel id
 * @retval zero: success
 * @retval non-zero: failure
 */
int hiudk_get_board_info(void *udkdev, struct hinic3_board_info *info, u16 channel);

/**
 * @brief hiudk_event_callback - evnet callback to notify service driver
 * @param udkdev: device pointer to udkdev
 * @param event: event info to service driver
 */
void hiudk_event_callback(void *udkdev, struct hinic3_event_info *event);

/**
 * @brief hiudk_link_event_stats - link event stats
 * @param udkdev: device pointer to udkdev
 * @param link: link status
 */
void hiudk_link_event_stats(void *udkdev, u8 link);

/**
 * @brief hiudk_get_hw_pf_infos - get pf infos
 * @param udkdev: device pointer to udkdev
 * @param infos: pf infos
 * @param channel: channel id
 */
int hiudk_get_hw_pf_infos(void *udkdev, struct hinic3_hw_pf_infos *infos, u16 channel);

/**
 * @brief hiudk_get_hw_pf_infos - get pf infos
 * @param udkdev: device pointer to udkdev
 * @param infos: bond infos
 * @param channel: channel id
 */
int hiudk_get_hw_bond_infos(void *udkdev, struct hinic3_hw_bond_infos *infos, u16 channel);

/**
 * @brief hiudk_func_reset - reset func
 * @param udkdev: device pointer to udkdev
 * @param func_id: global function index
 * @param reset_flag: reset flag
 * @param channel: channel id
 */
int hiudk_func_reset(void *udkdev, u16 func_id, u64 reset_flag, u16 channel);

void hiudk_force_complete_all(void *hwdev);

int hiudk_get_ceq_page_phy_addr(void *hwdev, u16 q_id,
				 u16 page_idx, u64 *page_phy_addr);

int hiudk_set_ceq_irq_disable(void *hwdev, u16 q_id);

int hiudk_mbox_ppf_to_host(void *hwdev, u8 mod, u16 cmd, u8 host_id,
			    void *buf_in, u16 in_size, void *buf_out,
			    u16 *out_size, u32 timeout, u16 channel);

int hiudk_get_ceq_info(void *hwdev, u16 q_id, struct hinic3_ceq_info *ceq_info);
int hiudk_init_single_ceq_status(void *hwdev, u16 q_id);

struct hiudk_hw_ops {
    int (*hiudk_aeq_register_hw_cb)(void *hwdev, void *pri_handle, enum hinic3_aeq_type event,
        hinic3_aeq_hwe_cb hwe_cb);
    int (*hiudk_aeq_register_swe_cb)(void *hwdev, void *pri_handle, enum hinic3_aeq_sw_type event,
        hinic3_aeq_swe_cb aeq_swe_cb);
    void (*hiudk_aeq_unregister_hw_cb)(void *hwdev, enum hinic3_aeq_type event);
    void (*hiudk_aeq_unregister_swe_cb)(void *hwdev, enum hinic3_aeq_sw_type event);
    struct hinic3_cmd_buf *(*hiudk_alloc_cmd_buf)(void *hwdev);
    int (*hiudk_alloc_db_addr)(void *hwdev, void __iomem **db_base, void __iomem **dwqe_base);
    int (*hiudk_alloc_db_phy_addr)(void *hwdev, u64 *db_base, u64 *dwqe_base);
    int (*hiudk_api_csr_rd64)(void *hwdev, u8 dest, u32 addr, u64 *val);
    int (*hiudk_ceq_register_cb)(void *hwdev, void *pri_handle, enum hinic3_ceq_event event,
        hinic3_ceq_event_cb callback);
    void (*hiudk_ceq_unregister_cb)(void *hwdev, enum hinic3_ceq_event event);
    int (*hiudk_clean_root_ctxt)(void *hwdev, u16 channel);
    int (*hiudk_cmdq_detail_resp)(void *hwdev, u8 mod, u8 cmd, struct hinic3_cmd_buf *buf_in,
        struct hinic3_cmd_buf *buf_out, u64 *out_param, u32 timeout, u16 channel);
    int (*hiudk_cmdq_direct_resp)(
        void *hwdev, u8 mod, u8 cmd, struct hinic3_cmd_buf *buf_in, u64 *out_param, u32 timeout, u16 channel);
    int (*hiudk_cos_id_detail_resp)(void *hwdev, u8 mod, u8 cmd, u8 cos_id, struct hinic3_cmd_buf *buf_in,
        struct hinic3_cmd_buf *buf_out, u64 *out_param, u32 timeout, u16 channel);
    void (*hiudk_event_callback)(void *hwdev, struct hinic3_event_info *event);
    void (*hiudk_free_cmd_buf)(void *hwdev, struct hinic3_cmd_buf *cmd_buf);
    void (*hiudk_free_db_addr)(void *hwdev, const void __iomem *db_base, void __iomem *dwqe_base);
    void (*hiudk_free_db_phy_addr)(void *hwdev, u64 db_base, u64 dwqe_base);
    int (*hiudk_func_reset)(void *hwdev, u16 func_id, u64 reset_flag, u16 channel);
    int (*hiudk_get_board_info)(void *hwdev, struct hinic3_board_info *info, u16 channel);
    int (*hiudk_get_hw_pf_infos)(void *hwdev, struct hinic3_hw_pf_infos *infos, u16 channel);
    void *(*hiudk_get_service_adapter)(void *hwdev, enum hinic3_service_type type);
    void (*hiudk_link_event_stats)(void *hwdev, u8 link);
    int (*hiudk_mbox_to_pf)(void *hwdev, u8 mod, u16 cmd, void *buf_in, u16 in_size, void *buf_out, u16 *out_size,
        u32 timeout, u16 channel);
    int (*hiudk_mbox_to_vf)(void *hwdev, u16 vf_id, u8 mod, u16 cmd, void *buf_in, u16 in_size, void *buf_out,
        u16 *out_size, u32 timeout, u16 channel);
    int (*hiudk_mbox_to_vf_no_ack)(void *hwdev, u16 vf_id, u8 mod, u16 cmd, void *buf_in, u16 in_size, void *buf_out,
        u16 *out_size, u16 channel);
    int (*hiudk_msg_to_mgmt_api_chain_async)(void *hwdev, u8 mod, u16 cmd, const void *buf_in, u16 in_size);
    int (*hiudk_msg_to_mgmt_async)(void *hwdev, u8 mod, u16 cmd, void *buf_in, u16 in_size, u16 channel);
    int (*hiudk_msg_to_mgmt_no_ack)(void *hwdev, u8 mod, u16 cmd, void *buf_in, u16 in_size, u16 channel);
    int (*hiudk_msg_to_mgmt_sync)(void *hwdev, u8 mod, u16 cmd, void *buf_in, u16 in_size, void *buf_out, u16 *out_size,
        u32 timeout, u16 channel);
    int (*hiudk_ppf_tmr_start)(void *hwdev);
    int (*hiudk_ppf_tmr_stop)(void *hwdev);
    int (*hiudk_register_mgmt_msg_cb)(void *hwdev, u8 mod, void *pri_handle, hinic3_mgmt_msg_cb callback);
    int (*hiudk_register_pf_mbox_cb)(void *hwdev, u8 mod, void *pri_handle, hinic3_pf_mbox_cb callback);
    int (*hiudk_register_ppf_mbox_cb)(void *hwdev, u8 mod, void *pri_handle, hinic3_ppf_mbox_cb callback);
    int (*hiudk_register_service_adapter)(void *hwdev, void *service_adapter, enum hinic3_service_type type);
    int (*hiudk_register_vf_mbox_cb)(void *hwdev, u8 mod, void *pri_handle, hinic3_vf_mbox_cb callback);
    int (*hiudk_set_root_ctxt)(void *hwdev, u32 rq_depth, u32 sq_depth, int rx_buf_sz, u16 channel);
    int (*hiudk_sm_ctr_rd64)(void *hwdev, u8 node, u8 instance, u32 ctr_id, u64 *value);
    void (*hiudk_unregister_mgmt_msg_cb)(void *hwdev, u8 mod);
    void (*hiudk_unregister_pf_mbox_cb)(void *hwdev, u8 mod);
    void (*hiudk_unregister_ppf_mbox_cb)(void *hwdev, u8 mod);
    void (*hiudk_unregister_service_adapter)(void *hwdev, enum hinic3_service_type type);
    void (*hiudk_unregister_vf_mbox_cb)(void *hwdev, u8 mod);
    void (*hiudk_force_complete_all)(void *hwdev);
    int (*hiudk_get_ceq_page_phy_addr)(void *hwdev, u16 q_id, u16 page_idx, u64 *page_phy_addr);
    int (*hiudk_set_ceq_irq_disable)(void *hwdev, u16 q_id);
    int (*hiudk_mbox_ppf_to_host)(void *hwdev, u8 mod, u16 cmd, u8 host_id,
                                void *buf_in, u16 in_size, void *buf_out,
                                u16 *out_size, u32 timeout, u16 channel);
    int (*hiudk_get_ceq_info)(void *hwdev, u16 q_id, struct hinic3_ceq_info *ceq_info);
    int (*hiudk_get_hw_bond_infos)(void *hwdev, struct hinic3_hw_bond_infos *infos, u16 channel);
    int (*hiudk_init_single_ceq_status)(void *hwdev, u16 q_id);
};


#endif
